<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<div class="row">
    <div class="col-lg-10 offset-lg-1">
        <div class="card">
            <div class="card-body">
                <form action="<?php echo url('plugin-setting-skiy_xcx_login');?>" method="post" id="form">
                <h4 class="card-title">微信小程序扫码登陆设置</h4>
                <div class="form-group row">
                    <label class="col-sm-2 form-control-label">APPID：</label>
                    <div class="col-sm-10">
                        <?php echo $input['app_id']; ?>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-2 form-control-label">APPSECRET</label>
                    <div class="col-sm-10">
                        <?php echo $input['app_secret']; ?>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-2 form-control-label">二维码有效时长(秒),0为不限制</label>
                    <div class="col-sm-10">
                        <?php echo $input['qrcode_expiry']; ?>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-2 form-control-label"></label>
                    <div class="col-sm-10">
                        <button type="submit" class="btn btn-primary btn-block" id="submit"
                                data-loading-text="<?php echo lang('submiting');?>..."><?php echo lang('confirm');?></button>
                        <a role="button" class="btn btn-secondary btn-block m-t-1"
                           href="javascript:history.back();"><?php echo lang('back');?></a>
                    </div>
                </div>
                </form>
                <p class="m-a-1 small"><strong>配置教程：</strong>
                    <a href="http://bbs.xiuno.com/thread-149396.htm" target="_blank">http://bbs.xiuno.com/thread-149396.htm</a>
                </p>
            </div>
        </div>
    </div>
</div>

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<script>
    let jform = $("#form");
    let jsubmit = $("#submit");
    let referer = '<?php echo http_referer();?>';
    jform.on('submit', function () {
        jform.reset();
        jsubmit.button('loading');
        let postdata = jform.serialize();
        $.xpost(jform.attr('action'), postdata, function (code, message) {
            if (code == 0) {
                $.alert(message);
                jsubmit.text(message).delay(2000).button('reset').location(referer);
                return;
            } else {
                $.alert(message);
                jsubmit.button('reset');
            }
        });
        return false;
    });
</script>